package com.and9.mchen.mcmusic.entity;

import java.io.Serializable;
import java.sql.Timestamp;

/**
 * 
 * @author MC
 * @version  1.0
 */
public class BaseEntity implements Serializable{
	
	/**
	 * 
	 */
	private static final long serialVersionUID = -2119121157371697408L;
	
	private Long id;//对象ID  在相同类型对象是唯一的
	private String uniqueId;// 唯一ID  在所有类型对象是惟一的
	private Timestamp createTime;//创建该对象时间
	private Timestamp lastUpdateTime;//最后修改该对象时间
	
	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public String getUniqueId() {
		return uniqueId;
	}

	public void setUniqueId(String uniqueId) {
		this.uniqueId = uniqueId;
	}

	public Timestamp getCreateTime() {
		return createTime;
	}

	public void setCreateTime(Timestamp createTime) {
		this.createTime = createTime;
	}

	public Timestamp getLastUpdateTime() {
		return lastUpdateTime;
	}

	public void setLastUpdateTime(Timestamp lastUpdateTime) {
		this.lastUpdateTime = lastUpdateTime;
	}


	@Override
	public boolean equals(Object obj) {
		if(this == obj){
			return true;
		}
		if(obj != null && obj.getClass() == BaseEntity.class){
			BaseEntity baseEntity=(BaseEntity)obj;
			if(baseEntity.getId().equals(this.getId()) && baseEntity.getUniqueId().equals(this.getUniqueId())){
				return true;
			}
		}
		return false;
	}
	
	@Override
	public int hashCode() {
		return this.getId().hashCode()*13+this.getUniqueId().hashCode()*17;
	}
	
	
	public BaseEntity getThis(){
		return this;
	}
}
